#ifndef SYNCED_COMMAND_IOSTREAM_H_INCLUDED
#define SYNCED_COMMAND_IOSTREAM_H_INCLUDED

#include <Common/IInputDevice.h>

#include <vector>
#include <boost/cstdint.hpp>
#include <boost/shared_ptr.hpp>

namespace Core {

class SyncedCommandIOStream : public Common::IInputDevice {
public :
	SyncedCommandIOStream() { }
	virtual ~SyncedCommandIOStream() { }
	
	virtual std::size_t write(std::vector<boost::uint8_t> const & inBytes) = 0;
	virtual std::size_t read(std::vector<boost::uint8_t> & outBytes) = 0;
	virtual std::size_t readAtLeast(
		std::vector<boost::uint8_t> & outBytes, std::size_t bytesPos, std::size_t atLeast) = 0; 
	
	/**
	 * From Common::IInputDevice
	 */
	virtual boost::int64_t expectedSize() const 
	{ 
		return 0; 
	}

	virtual std::size_t readBlock(char * buf, boost::int64_t from, boost::int64_t to) 
		throw (Common::InputDeviceException) 
	{ 
		return 0; 
	}
	
	virtual std::size_t readSome(char * buf, std::size_t bufferSize) 
	{
		return 0; 
	}

	virtual void close() = 0;
}; 

typedef boost::shared_ptr<SyncedCommandIOStream> SyncedCommandIOStreamPtr;

} // Core

#endif

